package com.atguigu.flink.chapter11;

import com.atguigu.flink.bean.Person;
import org.apache.flink.api.common.eventtime.WatermarkStrategy;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.Table;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

import java.time.Duration;

import static org.apache.flink.table.api.Expressions.$;

/**
 * @Author lzc
 * @Date 2022/3/11 9:02
 */
public class Flink12_Window_TVF_4 {
    public static void main(String[] args) throws Exception {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        // 1. 先创建一个流
        DataStream<Person> stream = env
                .fromElements(
                    new Person("a1", "b1", "c1", "d1", 1000L, 10),
                    new Person("a2", "b2", "c2", "d2", 2000L, 20),
                    new Person("a3", "b3", "c3", "d3", 3000L, 30),
                    new Person("a4", "b4", "c4", "d4", 4000L, 40),
                    new Person("a5", "b5", "c5", "d5", 5000L, 50),
                    new Person("a6", "b6", "c6", "d6", 6000L, 60),
                    new Person("a7", "b7", "c7", "d7", 7000L, 70),
                    new Person("a8", "b8", "c8", "d8", 8000L, 80)
                )
                .assignTimestampsAndWatermarks(
                        WatermarkStrategy
                                .<Person>forBoundedOutOfOrderness(Duration.ofSeconds(3))
                                .withTimestampAssigner((ws, ts) -> ws.getTs())

                );

        StreamTableEnvironment tEnv = StreamTableEnvironment.create(env);

        Table table = tEnv.fromDataStream(stream, $("a"), $("b"), $("c"), $("d"), $("ts").rowtime(), $("score"));
        tEnv.createTemporaryView("person", table);


        /*tEnv
                .sqlQuery("select" +
                        " a,b,c,d, window_start, window_end, " +
                        " sum(score) vc_sum " +
                        "from table( tumble(table person, descriptor(ts), interval '5' second) )" +
                        "group by window_start, window_end, grouping sets( " +
                        " (a,b,c,d), (a,b,c), (a,b), (a), ())" +
                        "")
                .execute()
                .print();*/

        /*tEnv
                .sqlQuery("select" +
                        " a,b,c,d, window_start, window_end, " +
                        " sum(score) vc_sum " +
                        "from table( tumble(table person, descriptor(ts), interval '5' second) )" +
                        "group by window_start, window_end, rollup(a,b,c,d)")
                .execute()
                .print();*/

                tEnv
                .sqlQuery("select" +
                        " a,b,c,d, window_start, window_end, " +
                        " sum(score) vc_sum " +
                        "from table( tumble(table person, descriptor(ts), interval '5' second) )" +
                        "group by window_start, window_end, cube(a,b,c,d)")
                .execute()
                .print();  // 1 + 4 + 6 + 4 + 1  (a,b,c,d) (a,b,c)(a,b,d)(a,c,d)


    }
}
/*
分组集  group sets

------
C:\Java\jdk1.8.0_102\bin\java.exe "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.3\lib\idea_rt.jar=62233:C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.3\bin" -Dfile.encoding=UTF-8 -classpath C:\Java\jdk1.8.0_102\jre\lib\charsets.jar;C:\Java\jdk1.8.0_102\jre\lib\deploy.jar;C:\Java\jdk1.8.0_102\jre\lib\ext\access-bridge-64.jar;C:\Java\jdk1.8.0_102\jre\lib\ext\cldrdata.jar;C:\Java\jdk1.8.0_102\jre\lib\ext\dnsns.jar;C:\Java\jdk1.8.0_102\jre\lib\ext\jaccess.jar;C:\Java\jdk1.8.0_102\jre\lib\ext\jfxrt.jar;C:\Java\jdk1.8.0_102\jre\lib\ext\localedata.jar;C:\Java\jdk1.8.0_102\jre\lib\ext\nashorn.jar;C:\Java\jdk1.8.0_102\jre\lib\ext\sunec.jar;C:\Java\jdk1.8.0_102\jre\lib\ext\sunjce_provider.jar;C:\Java\jdk1.8.0_102\jre\lib\ext\sunmscapi.jar;C:\Java\jdk1.8.0_102\jre\lib\ext\sunpkcs11.jar;C:\Java\jdk1.8.0_102\jre\lib\ext\zipfs.jar;C:\Java\jdk1.8.0_102\jre\lib\javaws.jar;C:\Java\jdk1.8.0_102\jre\lib\jce.jar;C:\Java\jdk1.8.0_102\jre\lib\jfr.jar;C:\Java\jdk1.8.0_102\jre\lib\jfxswt.jar;C:\Java\jdk1.8.0_102\jre\lib\jsse.jar;C:\Java\jdk1.8.0_102\jre\lib\management-agent.jar;C:\Java\jdk1.8.0_102\jre\lib\plugin.jar;C:\Java\jdk1.8.0_102\jre\lib\resources.jar;C:\Java\jdk1.8.0_102\jre\lib\rt.jar;C:\Users\lzc\Desktop\class_code\prepare\flink210924\target\classes;C:\Users\lzc\.m2\repository\org\apache\flink\flink-java\1.13.6\flink-java-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-core\1.13.6\flink-core-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-annotations\1.13.6\flink-annotations-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-metrics-core\1.13.6\flink-metrics-core-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-shaded-asm-7\7.1-13.0\flink-shaded-asm-7-7.1-13.0.jar;C:\Users\lzc\.m2\repository\com\esotericsoftware\kryo\kryo\2.24.0\kryo-2.24.0.jar;C:\Users\lzc\.m2\repository\com\esotericsoftware\minlog\minlog\1.2\minlog-1.2.jar;C:\Users\lzc\.m2\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;C:\Users\lzc\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\lzc\.m2\repository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;C:\Users\lzc\.m2\repository\org\apache\commons\commons-math3\3.5\commons-math3-3.5.jar;C:\Users\lzc\.m2\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;C:\Users\lzc\.m2\repository\org\apache\flink\force-shading\1.13.6\force-shading-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-streaming-java_2.11\1.13.6\flink-streaming-java_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-file-sink-common\1.13.6\flink-file-sink-common-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-runtime_2.11\1.13.6\flink-runtime_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-queryable-state-client-java\1.13.6\flink-queryable-state-client-java-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-hadoop-fs\1.13.6\flink-hadoop-fs-1.13.6.jar;C:\Users\lzc\.m2\repository\commons-io\commons-io\2.8.0\commons-io-2.8.0.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-shaded-zookeeper-3\3.4.14-13.0\flink-shaded-zookeeper-3-3.4.14-13.0.jar;C:\Users\lzc\.m2\repository\org\javassist\javassist\3.24.0-GA\javassist-3.24.0-GA.jar;C:\Users\lzc\.m2\repository\com\typesafe\akka\akka-actor_2.11\2.5.21\akka-actor_2.11-2.5.21.jar;C:\Users\lzc\.m2\repository\com\typesafe\config\1.3.3\config-1.3.3.jar;C:\Users\lzc\.m2\repository\org\scala-lang\modules\scala-java8-compat_2.11\0.7.0\scala-java8-compat_2.11-0.7.0.jar;C:\Users\lzc\.m2\repository\com\typesafe\akka\akka-stream_2.11\2.5.21\akka-stream_2.11-2.5.21.jar;C:\Users\lzc\.m2\repository\org\reactivestreams\reactive-streams\1.0.2\reactive-streams-1.0.2.jar;C:\Users\lzc\.m2\repository\com\typesafe\ssl-config-core_2.11\0.3.7\ssl-config-core_2.11-0.3.7.jar;C:\Users\lzc\.m2\repository\com\typesafe\akka\akka-protobuf_2.11\2.5.21\akka-protobuf_2.11-2.5.21.jar;C:\Users\lzc\.m2\repository\com\typesafe\akka\akka-slf4j_2.11\2.5.21\akka-slf4j_2.11-2.5.21.jar;C:\Users\lzc\.m2\repository\org\clapper\grizzled-slf4j_2.11\1.3.2\grizzled-slf4j_2.11-1.3.2.jar;C:\Users\lzc\.m2\repository\com\github\scopt\scopt_2.11\3.5.0\scopt_2.11-3.5.0.jar;C:\Users\lzc\.m2\repository\org\xerial\snappy\snappy-java\1.1.8.3\snappy-java-1.1.8.3.jar;C:\Users\lzc\.m2\repository\com\twitter\chill_2.11\0.7.6\chill_2.11-0.7.6.jar;C:\Users\lzc\.m2\repository\com\twitter\chill-java\0.7.6\chill-java-0.7.6.jar;C:\Users\lzc\.m2\repository\org\lz4\lz4-java\1.6.0\lz4-java-1.6.0.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-shaded-guava\18.0-13.0\flink-shaded-guava-18.0-13.0.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-clients_2.11\1.13.6\flink-clients_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-optimizer_2.11\1.13.6\flink-optimizer_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\commons-cli\commons-cli\1.3.1\commons-cli-1.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-runtime-web_2.11\1.13.6\flink-runtime-web_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-shaded-netty\4.1.49.Final-13.0\flink-shaded-netty-4.1.49.Final-13.0.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-shaded-jackson\2.12.1-13.0\flink-shaded-jackson-2.12.1-13.0.jar;C:\Users\lzc\.m2\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;C:\Users\lzc\.m2\repository\org\slf4j\slf4j-log4j12\1.7.30\slf4j-log4j12-1.7.30.jar;C:\Users\lzc\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;C:\Users\lzc\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.14.0\log4j-to-slf4j-2.14.0.jar;C:\Users\lzc\.m2\repository\org\apache\logging\log4j\log4j-api\2.14.0\log4j-api-2.14.0.jar;C:\Users\lzc\.m2\repository\org\projectlombok\lombok\1.18.16\lombok-1.18.16.jar;C:\Users\lzc\.m2\repository\org\apache\hadoop\hadoop-client\3.1.3\hadoop-client-3.1.3.jar;C:\Users\lzc\.m2\repository\org\apache\hadoop\hadoop-common\3.1.3\hadoop-common-3.1.3.jar;C:\Users\lzc\.m2\repository\com\google\guava\guava\27.0-jre\guava-27.0-jre.jar;C:\Users\lzc\.m2\repository\com\google\guava\failureaccess\1.0\failureaccess-1.0.jar;C:\Users\lzc\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\lzc\.m2\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;C:\Users\lzc\.m2\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;C:\Users\lzc\.m2\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;C:\Users\lzc\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;C:\Users\lzc\.m2\repository\org\apache\httpcomponents\httpclient\4.5.2\httpclient-4.5.2.jar;C:\Users\lzc\.m2\repository\org\apache\httpcomponents\httpcore\4.4.4\httpcore-4.4.4.jar;C:\Users\lzc\.m2\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;C:\Users\lzc\.m2\repository\commons-net\commons-net\3.6\commons-net-3.6.jar;C:\Users\lzc\.m2\repository\org\eclipse\jetty\jetty-servlet\9.3.24.v20180605\jetty-servlet-9.3.24.v20180605.jar;C:\Users\lzc\.m2\repository\org\eclipse\jetty\jetty-security\9.3.24.v20180605\jetty-security-9.3.24.v20180605.jar;C:\Users\lzc\.m2\repository\org\eclipse\jetty\jetty-webapp\9.3.24.v20180605\jetty-webapp-9.3.24.v20180605.jar;C:\Users\lzc\.m2\repository\org\eclipse\jetty\jetty-xml\9.3.24.v20180605\jetty-xml-9.3.24.v20180605.jar;C:\Users\lzc\.m2\repository\javax\servlet\jsp\jsp-api\2.1\jsp-api-2.1.jar;C:\Users\lzc\.m2\repository\com\sun\jersey\jersey-servlet\1.19\jersey-servlet-1.19.jar;C:\Users\lzc\.m2\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;C:\Users\lzc\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\lzc\.m2\repository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;C:\Users\lzc\.m2\repository\org\apache\commons\commons-configuration2\2.1.1\commons-configuration2-2.1.1.jar;C:\Users\lzc\.m2\repository\org\apache\avro\avro\1.7.7\avro-1.7.7.jar;C:\Users\lzc\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.9.13\jackson-core-asl-1.9.13.jar;C:\Users\lzc\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.13\jackson-mapper-asl-1.9.13.jar;C:\Users\lzc\.m2\repository\com\thoughtworks\paranamer\paranamer\2.3\paranamer-2.3.jar;C:\Users\lzc\.m2\repository\com\google\re2j\re2j\1.1\re2j-1.1.jar;C:\Users\lzc\.m2\repository\com\google\protobuf\protobuf-java\2.5.0\protobuf-java-2.5.0.jar;C:\Users\lzc\.m2\repository\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;C:\Users\lzc\.m2\repository\org\apache\hadoop\hadoop-auth\3.1.3\hadoop-auth-3.1.3.jar;C:\Users\lzc\.m2\repository\com\nimbusds\nimbus-jose-jwt\4.41.1\nimbus-jose-jwt-4.41.1.jar;C:\Users\lzc\.m2\repository\com\github\stephenc\jcip\jcip-annotations\1.0-1\jcip-annotations-1.0-1.jar;C:\Users\lzc\.m2\repository\net\minidev\json-smart\2.3\json-smart-2.3.jar;C:\Users\lzc\.m2\repository\net\minidev\accessors-smart\1.2\accessors-smart-1.2.jar;C:\Users\lzc\.m2\repository\org\ow2\asm\asm\5.0.4\asm-5.0.4.jar;C:\Users\lzc\.m2\repository\org\apache\curator\curator-framework\2.13.0\curator-framework-2.13.0.jar;C:\Users\lzc\.m2\repository\org\apache\curator\curator-client\2.13.0\curator-client-2.13.0.jar;C:\Users\lzc\.m2\repository\org\apache\curator\curator-recipes\2.13.0\curator-recipes-2.13.0.jar;C:\Users\lzc\.m2\repository\org\apache\htrace\htrace-core4\4.1.0-incubating\htrace-core4-4.1.0-incubating.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerb-simplekdc\1.0.1\kerb-simplekdc-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerb-client\1.0.1\kerb-client-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerby-config\1.0.1\kerby-config-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerb-core\1.0.1\kerb-core-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerby-pkix\1.0.1\kerby-pkix-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerby-asn1\1.0.1\kerby-asn1-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerby-util\1.0.1\kerby-util-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerb-common\1.0.1\kerb-common-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerb-crypto\1.0.1\kerb-crypto-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerb-util\1.0.1\kerb-util-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\token-provider\1.0.1\token-provider-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerb-admin\1.0.1\kerb-admin-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerb-server\1.0.1\kerb-server-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerb-identity\1.0.1\kerb-identity-1.0.1.jar;C:\Users\lzc\.m2\repository\org\apache\kerby\kerby-xdr\1.0.1\kerby-xdr-1.0.1.jar;C:\Users\lzc\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.7.8\jackson-databind-2.7.8.jar;C:\Users\lzc\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.7.8\jackson-core-2.7.8.jar;C:\Users\lzc\.m2\repository\org\codehaus\woodstox\stax2-api\3.1.4\stax2-api-3.1.4.jar;C:\Users\lzc\.m2\repository\com\fasterxml\woodstox\woodstox-core\5.0.3\woodstox-core-5.0.3.jar;C:\Users\lzc\.m2\repository\org\apache\hadoop\hadoop-hdfs-client\3.1.3\hadoop-hdfs-client-3.1.3.jar;C:\Users\lzc\.m2\repository\com\squareup\okhttp\okhttp\2.7.5\okhttp-2.7.5.jar;C:\Users\lzc\.m2\repository\com\squareup\okio\okio\1.6.0\okio-1.6.0.jar;C:\Users\lzc\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.7.8\jackson-annotations-2.7.8.jar;C:\Users\lzc\.m2\repository\org\apache\hadoop\hadoop-yarn-api\3.1.3\hadoop-yarn-api-3.1.3.jar;C:\Users\lzc\.m2\repository\javax\xml\bind\jaxb-api\2.2.11\jaxb-api-2.2.11.jar;C:\Users\lzc\.m2\repository\org\apache\hadoop\hadoop-yarn-client\3.1.3\hadoop-yarn-client-3.1.3.jar;C:\Users\lzc\.m2\repository\org\apache\hadoop\hadoop-mapreduce-client-core\3.1.3\hadoop-mapreduce-client-core-3.1.3.jar;C:\Users\lzc\.m2\repository\org\apache\hadoop\hadoop-yarn-common\3.1.3\hadoop-yarn-common-3.1.3.jar;C:\Users\lzc\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;C:\Users\lzc\.m2\repository\org\eclipse\jetty\jetty-util\9.3.24.v20180605\jetty-util-9.3.24.v20180605.jar;C:\Users\lzc\.m2\repository\com\sun\jersey\jersey-core\1.19\jersey-core-1.19.jar;C:\Users\lzc\.m2\repository\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;C:\Users\lzc\.m2\repository\com\sun\jersey\jersey-client\1.19\jersey-client-1.19.jar;C:\Users\lzc\.m2\repository\com\fasterxml\jackson\module\jackson-module-jaxb-annotations\2.7.8\jackson-module-jaxb-annotations-2.7.8.jar;C:\Users\lzc\.m2\repository\com\fasterxml\jackson\jaxrs\jackson-jaxrs-json-provider\2.7.8\jackson-jaxrs-json-provider-2.7.8.jar;C:\Users\lzc\.m2\repository\com\fasterxml\jackson\jaxrs\jackson-jaxrs-base\2.7.8\jackson-jaxrs-base-2.7.8.jar;C:\Users\lzc\.m2\repository\org\apache\hadoop\hadoop-mapreduce-client-jobclient\3.1.3\hadoop-mapreduce-client-jobclient-3.1.3.jar;C:\Users\lzc\.m2\repository\org\apache\hadoop\hadoop-mapreduce-client-common\3.1.3\hadoop-mapreduce-client-common-3.1.3.jar;C:\Users\lzc\.m2\repository\org\apache\hadoop\hadoop-annotations\3.1.3\hadoop-annotations-3.1.3.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-connector-kafka_2.11\1.13.6\flink-connector-kafka_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\kafka\kafka-clients\2.4.1\kafka-clients-2.4.1.jar;C:\Users\lzc\.m2\repository\com\github\luben\zstd-jni\1.4.3-1\zstd-jni-1.4.3-1.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-connector-base\1.13.6\flink-connector-base-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-connector-redis_2.11\1.1.5\flink-connector-redis_2.11-1.1.5.jar;C:\Users\lzc\.m2\repository\redis\clients\jedis\2.8.0\jedis-2.8.0.jar;C:\Users\lzc\.m2\repository\org\apache\commons\commons-pool2\2.3\commons-pool2-2.3.jar;C:\Users\lzc\.m2\repository\com\alibaba\fastjson\1.2.75\fastjson-1.2.75.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-connector-elasticsearch6_2.11\1.13.6\flink-connector-elasticsearch6_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-connector-elasticsearch-base_2.11\1.13.6\flink-connector-elasticsearch-base_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\elasticsearch\client\elasticsearch-rest-high-level-client\6.3.1\elasticsearch-rest-high-level-client-6.3.1.jar;C:\Users\lzc\.m2\repository\org\elasticsearch\elasticsearch\6.3.1\elasticsearch-6.3.1.jar;C:\Users\lzc\.m2\repository\org\elasticsearch\elasticsearch-core\6.3.1\elasticsearch-core-6.3.1.jar;C:\Users\lzc\.m2\repository\org\elasticsearch\elasticsearch-secure-sm\6.3.1\elasticsearch-secure-sm-6.3.1.jar;C:\Users\lzc\.m2\repository\org\elasticsearch\elasticsearch-x-content\6.3.1\elasticsearch-x-content-6.3.1.jar;C:\Users\lzc\.m2\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;C:\Users\lzc\.m2\repository\com\fasterxml\jackson\dataformat\jackson-dataformat-smile\2.8.10\jackson-dataformat-smile-2.8.10.jar;C:\Users\lzc\.m2\repository\com\fasterxml\jackson\dataformat\jackson-dataformat-yaml\2.8.10\jackson-dataformat-yaml-2.8.10.jar;C:\Users\lzc\.m2\repository\com\fasterxml\jackson\dataformat\jackson-dataformat-cbor\2.8.10\jackson-dataformat-cbor-2.8.10.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-core\7.3.1\lucene-core-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-analyzers-common\7.3.1\lucene-analyzers-common-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-backward-codecs\7.3.1\lucene-backward-codecs-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-grouping\7.3.1\lucene-grouping-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-highlighter\7.3.1\lucene-highlighter-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-join\7.3.1\lucene-join-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-memory\7.3.1\lucene-memory-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-misc\7.3.1\lucene-misc-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-queries\7.3.1\lucene-queries-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-queryparser\7.3.1\lucene-queryparser-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-sandbox\7.3.1\lucene-sandbox-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-spatial\7.3.1\lucene-spatial-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-spatial-extras\7.3.1\lucene-spatial-extras-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-spatial3d\7.3.1\lucene-spatial3d-7.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\lucene\lucene-suggest\7.3.1\lucene-suggest-7.3.1.jar;C:\Users\lzc\.m2\repository\org\elasticsearch\elasticsearch-cli\6.3.1\elasticsearch-cli-6.3.1.jar;C:\Users\lzc\.m2\repository\net\sf\jopt-simple\jopt-simple\5.0.2\jopt-simple-5.0.2.jar;C:\Users\lzc\.m2\repository\com\carrotsearch\hppc\0.7.1\hppc-0.7.1.jar;C:\Users\lzc\.m2\repository\joda-time\joda-time\2.9.9\joda-time-2.9.9.jar;C:\Users\lzc\.m2\repository\com\tdunning\t-digest\3.2\t-digest-3.2.jar;C:\Users\lzc\.m2\repository\org\hdrhistogram\HdrHistogram\2.1.9\HdrHistogram-2.1.9.jar;C:\Users\lzc\.m2\repository\org\elasticsearch\jna\4.5.1\jna-4.5.1.jar;C:\Users\lzc\.m2\repository\org\elasticsearch\client\elasticsearch-rest-client\6.3.1\elasticsearch-rest-client-6.3.1.jar;C:\Users\lzc\.m2\repository\org\apache\httpcomponents\httpasyncclient\4.1.2\httpasyncclient-4.1.2.jar;C:\Users\lzc\.m2\repository\org\apache\httpcomponents\httpcore-nio\4.4.5\httpcore-nio-4.4.5.jar;C:\Users\lzc\.m2\repository\org\elasticsearch\plugin\parent-join-client\6.3.1\parent-join-client-6.3.1.jar;C:\Users\lzc\.m2\repository\org\elasticsearch\plugin\aggs-matrix-stats-client\6.3.1\aggs-matrix-stats-client-6.3.1.jar;C:\Users\lzc\.m2\repository\org\elasticsearch\plugin\rank-eval-client\6.3.1\rank-eval-client-6.3.1.jar;C:\Users\lzc\.m2\repository\mysql\mysql-connector-java\5.1.49\mysql-connector-java-5.1.49.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-connector-jdbc_2.11\1.13.6\flink-connector-jdbc_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-statebackend-rocksdb_2.11\1.13.6\flink-statebackend-rocksdb_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\com\ververica\frocksdbjni\5.17.2-ververica-2.1\frocksdbjni-5.17.2-ververica-2.1.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-cep_2.11\1.13.6\flink-cep_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-table-planner-blink_2.11\1.13.6\flink-table-planner-blink_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-table-common\1.13.6\flink-table-common-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-connector-files\1.13.6\flink-connector-files-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-table-api-java\1.13.6\flink-table-api-java-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-table-api-scala_2.11\1.13.6\flink-table-api-scala_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-table-api-java-bridge_2.11\1.13.6\flink-table-api-java-bridge_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-table-api-scala-bridge_2.11\1.13.6\flink-table-api-scala-bridge_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-table-runtime-blink_2.11\1.13.6\flink-table-runtime-blink_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\codehaus\janino\janino\3.0.11\janino-3.0.11.jar;C:\Users\lzc\.m2\repository\org\codehaus\janino\commons-compiler\3.0.11\commons-compiler-3.0.11.jar;C:\Users\lzc\.m2\repository\org\apache\calcite\avatica\avatica-core\1.17.0\avatica-core-1.17.0.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-streaming-scala_2.11\1.13.6\flink-streaming-scala_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-scala_2.11\1.13.6\flink-scala_2.11-1.13.6.jar;C:\Users\lzc\.m2\repository\org\scala-lang\scala-reflect\2.11.12\scala-reflect-2.11.12.jar;C:\Users\lzc\.m2\repository\org\scala-lang\scala-library\2.11.12\scala-library-2.11.12.jar;C:\Users\lzc\.m2\repository\org\scala-lang\scala-compiler\2.11.12\scala-compiler-2.11.12.jar;C:\Users\lzc\.m2\repository\org\scala-lang\modules\scala-xml_2.11\1.0.5\scala-xml_2.11-1.0.5.jar;C:\Users\lzc\.m2\repository\org\scala-lang\modules\scala-parser-combinators_2.11\1.0.4\scala-parser-combinators_2.11-1.0.4.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-csv\1.13.6\flink-csv-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\flink\flink-json\1.13.6\flink-json-1.13.6.jar;C:\Users\lzc\.m2\repository\org\apache\commons\commons-compress\1.21\commons-compress-1.21.jar com.atguigu.flink.chapter11.Flink12_Window_TVF_4
+----+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-------------------------+-------------------------+-------------+
| op |                              a |                              b |                              c |                              d |            window_start |              window_end |      vc_sum |
+----+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-------------------------+-------------------------+-------------+
| +I |                             a1 |                             b1 |                             c1 |                             d1 | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          10 |
| +I |                             a1 |                             b1 |                             c1 |                         (NULL) | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          10 |
| +I |                             a1 |                         (NULL) |                         (NULL) |                         (NULL) | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          10 |
| +I |                             a2 |                             b2 |                         (NULL) |                         (NULL) | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          20 |
| +I |                             a4 |                             b4 |                         (NULL) |                         (NULL) | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          40 |
| +I |                             a4 |                         (NULL) |                         (NULL) |                         (NULL) | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          40 |
| +I |                             a2 |                         (NULL) |                         (NULL) |                         (NULL) | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          20 |
| +I |                         (NULL) |                         (NULL) |                         (NULL) |                         (NULL) | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |         100 |
| +I |                             a3 |                             b3 |                             c3 |                             d3 | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          30 |
| +I |                             a3 |                             b3 |                             c3 |                         (NULL) | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          30 |
| +I |                             a1 |                             b1 |                         (NULL) |                         (NULL) | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          10 |
| +I |                             a2 |                             b2 |                             c2 |                             d2 | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          20 |
| +I |                             a3 |                             b3 |                         (NULL) |                         (NULL) | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          30 |
| +I |                             a3 |                         (NULL) |                         (NULL) |                         (NULL) | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          30 |
| +I |                             a2 |                             b2 |                             c2 |                         (NULL) | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          20 |
| +I |                             a4 |                             b4 |                             c4 |                             d4 | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          40 |
| +I |                             a4 |                             b4 |                             c4 |                         (NULL) | 1970-01-01 00:00:00.000 | 1970-01-01 00:00:05.000 |          40 |
| +I |                             a5 |                             b5 |                             c5 |                             d5 | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          50 |
| +I |                             a8 |                             b8 |                         (NULL) |                         (NULL) | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          80 |
| +I |                             a8 |                         (NULL) |                         (NULL) |                         (NULL) | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          80 |
| +I |                             a5 |                         (NULL) |                         (NULL) |                         (NULL) | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          50 |
| +I |                         (NULL) |                         (NULL) |                         (NULL) |                         (NULL) | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |         260 |
| +I |                             a6 |                             b6 |                             c6 |                         (NULL) | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          60 |
| +I |                             a6 |                             b6 |                         (NULL) |                         (NULL) | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          60 |
| +I |                             a7 |                             b7 |                             c7 |                         (NULL) | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          70 |
| +I |                             a7 |                             b7 |                         (NULL) |                         (NULL) | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          70 |
| +I |                             a8 |                             b8 |                             c8 |                             d8 | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          80 |
| +I |                             a8 |                             b8 |                             c8 |                         (NULL) | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          80 |
| +I |                             a5 |                             b5 |                         (NULL) |                         (NULL) | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          50 |
| +I |                             a6 |                             b6 |                             c6 |                             d6 | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          60 |
| +I |                             a7 |                             b7 |                             c7 |                             d7 | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          70 |
| +I |                             a7 |                         (NULL) |                         (NULL) |                         (NULL) | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          70 |
| +I |                             a5 |                             b5 |                             c5 |                         (NULL) | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          50 |
| +I |                             a6 |                         (NULL) |                         (NULL) |                         (NULL) | 1970-01-01 00:00:05.000 | 1970-01-01 00:00:10.000 |          60 |
+----+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-------------------------+-------------------------+-------------+
34 rows in set

Process finished with exit code 0




 */